package com.JustTest;

public class Singleton {
    static {
        System.out.println("Singleton.<clinit>");
    }
    private Singleton() {
    }

    public static Object getInstance(boolean flag) {
        if (flag) {
            return new LazyHolder[2];
        }
        return LazyHolder.INSTANCE;
    }

//    public static void main(String[] args) {
//        System.out.println("3333");
//        getInstance(true);
//        System.out.println("---+++++++++++-");
//        getInstance(false);
//    }

    private static class LazyHolder {

        static final Singleton INSTANCE = new Singleton();

        static {
            System.out.println("LazyHolder.<clinit>");
        }
    }

    public int test(int a){return 0;}
    public String test(String a){
        return "123";
    }
}